package com.foreknow.mapping;

import javax.swing.border.EmptyBorder;
import java.util.HashMap;
import java.util.Map;

public class MappingFactoy {
    private static MappingFactoy mappingfactoy = null;
    //创建一个Map容器用于保存xxxMapping
    private Map<String,EntityMapping> maps = new HashMap<>();
    public static final String  USER_MAPPING = "userMapping";
    public static final String Guestbook_Mapping = "GuestbookMapping";
    private MappingFactoy(){
    }
    public static MappingFactoy getInstance(){
        if (mappingfactoy == null){
             mappingfactoy = new MappingFactoy();
            mappingfactoy.maps.put(USER_MAPPING,new UserMapping());
            mappingfactoy.maps.put(Guestbook_Mapping,new GuestbookMapping());
        }
        return mappingfactoy;
    }
    public EntityMapping getmapping(String key){
        return maps.get(key);
    }
}
